﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using File_Manager.Models;

namespace File_Manager.Controllers
{
    [Authorize(Roles = "Admin")]
    public class User_IController : Controller
    {
        private CYTContext db = new CYTContext();

        //
        // GET: /User_I/
        /*
                public ViewResult Index()
                {
                    return View(db.User_I.ToList());
                }

     
                //
                // GET: /User_I/Details/5

                public ViewResult Details(string id)
                {
                    User_I user_i = db.User_I.Find(id);
                    return View(user_i);
                }

                //
                // GET: /User_I/Create

                public ActionResult Create()
                {
                    return View();
                } 

                //
                // POST: /User_I/Create

                [HttpPost]
                public ActionResult Create(User_I user_i)
                {
                    if (ModelState.IsValid)
                    {
                        db.User_I.Add(user_i);
                        db.SaveChanges();
                        return RedirectToAction("Index");  
                    }

                    return View(user_i);
                }
        
                //
                // GET: /User_I/Edit/5
 
                public ActionResult Edit(string id)
                {
                    User_I user_i = db.User_I.Find(id);
                    return View(user_i);
                }

                //
                // POST: /User_I/Edit/5

                [HttpPost]
                public ActionResult Edit(User_I user_i)
                {
                    if (ModelState.IsValid)
                    {
                        db.Entry(user_i).State = EntityState.Modified;
                        db.SaveChanges();
                        return RedirectToAction("Index");
                    }
                    return View(user_i);
                }

                //
                // GET: /User_I/Delete/5
 
                public ActionResult Delete(string id)
                {
                    User_I user_i = db.User_I.Find(id);
                    return View(user_i);
                }

                //
                // POST: /User_I/Delete/5

                [HttpPost, ActionName("Delete")]
                public ActionResult DeleteConfirmed(string id)
                {            
                    User_I user_i = db.User_I.Find(id);
                    db.User_I.Remove(user_i);
                    db.SaveChanges();
                    return RedirectToAction("Index");
                }*/

        protected override void Dispose(bool disposing)
        {
            db.Dispose();
            base.Dispose(disposing);
        }
    }
}